import pymongo
from sqlalchemy import create_engine
from redis import Connection, ConnectionPool, Redis
from urllib.parse import quote

mongo_url = "mongodb://rwuser:Gr#54WE24KL!dfjh5!!lkfg874@localhost:27017/bigdata?authSource=admin&directConnection=true"
mongo_client = pymongo.MongoClient(mongo_url, minPoolSize=5)
bigdata = mongo_client.bigdata
ac_task_col = bigdata.annotated_acceptance_task
check_frame_label_col = bigdata.check_frame_label
gt_task_col = bigdata.annotated_ground_truth_task
gt_task_item_col = bigdata.annotated_ground_truth_task_item
clip_annotated_record = bigdata.clip_annotated_record
clip_col = bigdata.clip
bag_col = bigdata.bag
frame_col = bigdata.frame
static_auto_label = bigdata.static_auto_label
homologous_clip = bigdata.homologous_clip

mysql_engine = create_engine(
    "mysql+pymysql://root:Hl76##fds87FS093498!aac667@localhost:3306/bdc?charset=utf8mb4"
)
mysql_pwd = quote("zdrive@Test2023")
mysql_stage_engine = create_engine(
    f"mysql+pymysql://root:{mysql_pwd}@172.25.117.3:3306/bdc_v3?charset=utf8mb4"
)

pwd = quote("S8!fhh983LKDsSfg6#!lldf09H")
redis_url = f"redis://:{pwd}@172.25.126.68:7885/0"
redis_client = Redis.from_url(
    redis_url, decode_responses=True, encoding="utf-8", encoding_errors="strict"
)
